import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '服务人员姓名',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '头像',
    align: "center",
    dataIndex: 'avatar',
    customRender: render.renderImage,
  },
  {
    title: '微信openid',
    align: "center",
    dataIndex: 'openid'
  },
  {
    title: '微信unionid',
    align: "center",
    dataIndex: 'unionid'
  },
  {
    title: '身份证号',
    align: "center",
    dataIndex: 'idcard'
  },
  {
    title: '手机号码',
    align: "center",
    dataIndex: 'phone'
  },
  {
    title: '是否有效',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '性别',
    align: "center",
    dataIndex: 'sex_dictText'
  },
  {
    title: '是否专家',
    align: "center",
    dataIndex: 'isExpert_dictText'
  },
  {
    title: '是否健康管家',
    align: "center",
    dataIndex: 'isHealth',
    customRender: ({ text }) => {
      return text === '1' ? '是' : text === '0' ? '否' : text;
    }
  },
  {
    title: '职业',
    align: "center",
    dataIndex: 'job'
  },
  {
    title: '是否上架',
    align: "center",
    dataIndex: 'validate',
    customRender: ({ text }) => {
      return text === '1' ? '是' : text === '0' ? '否' : text;
    }
  },
  {
    title: '费用',
    align: "center",
    dataIndex: 'fee'
  },
  {
    title: '医院',
    align: "center",
    dataIndex: 'hospital',
    width: 200
  },
  {
    title: '医院名称',
    align: "center",
    dataIndex: 'hospitalname'
  },
  {
    title: '项目组id',
    align: "center",
    dataIndex: 'projectid',
    width: 200
  },
  {
    title: '项目组名称',
    align: "center",
    dataIndex: 'projectname'
  },
  {
    title: '是否显示到微信',
    align: "center",
    dataIndex: 'isShow_dictText'
  },
  {
    title: '服务年限',
    align: "center",
    dataIndex: 'life'
  },
  {
    title: '服务人数',
    align: "center",
    dataIndex: 'server'
  },
  {
    title: '地区',
    align: "center",
    dataIndex: 'area'
  },
  {
    title: '地区名称',
    align: "center",
    dataIndex: 'areaName'
  },
  {
    title: '评分',
    align: "center",
    dataIndex: 'rate'
  },
  {
    title: '简介',
    align: "center",
    dataIndex: 'profile'
  },
  // {
  //   title: '佣金比例',
  //   align: "center",
  //   dataIndex: 'ratio'
  // },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "服务人员姓名",
    field: "name",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "微信openid",
    field: "openid",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "身份证号",
    field: "idcard",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "医院",
    field: "hospital",
    component: 'JSearchSelect',
    componentProps: {
      dict: "nurse_hospital,name,id",
      placeholder: '请选择医院',
    },
    //colProps: {span: 6},
  },
  {
    label: "手机号码",
    field: "phone",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "是否有效",
    field: "status",
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "valid_status"
    },
    //colProps: {span: 6},
  },
  {
    label: "是否显示到微信",
    field: "isShow",
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_is_show"
    },
    //colProps: {span: 6},
  },
  {
    label: "是否健康管家",
    field: "isHealth",
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "yes_no"
    },
    //colProps: {span: 6},
  },
  {
    label: "服务年限",
    field: "life",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "地区名称",
    field: "areaName",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "职业",
    field: "job",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "是否上架",
    field: "validate",
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "yes_no"
    },
    //colProps: {span: 6},
  },
];

//表单数据


//子表列表数据
export const nurseNursesCertificateColumns: BasicColumn[] = [
  {
    title: '证书编码',
    align: "center",
    dataIndex: 'code'
  },
  {
    title: '证书名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '证书说明',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '证书图片',
    align: "center",
    dataIndex: 'pic',
    customRender: render.renderImage,
  },
  {
    title: '护工ID',
    align: "center",
    dataIndex: 'nursesId'
  },
];
//子表表单数据
export const nurseNursesCertificateFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '证书编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '证书名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入证书名称!' },
      ];
    },
  },
  {
    label: '证书说明',
    field: 'description',
    component: 'Input',
  },
  {
    label: '证书图片',
    field: 'pic',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 1
    },
  },
];
//子表列表数据
export const nurseNursesCommentColumns: BasicColumn[] = [
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '评论标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '评价',
    align: "center",
    dataIndex: 'evaluate'
  },
  {
    title: '评论详情',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '评分',
    align: "center",
    dataIndex: 'rate'
  },
  {
    title: '评论图片',
    align: "center",
    dataIndex: 'pic',
    customRender: render.renderImage,
  },
  {
    title: '护工ID',
    align: "center",
    dataIndex: 'nursesId'
  },
  {
    title: '订单ID',
    align: "center",
    dataIndex: 'orderId'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
];
//子表表单数据
export const nurseNursesCommentFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '评论标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '评价',
    field: 'evaluate',
    component: 'Input',
  },
  {
    label: '评论详情',
    field: 'description',
    component: 'InputTextArea',
  },
  {
    label: '评分',
    field: 'rate',
    component: 'InputNumber',
  },
  {
    label: '评论图片',
    field: 'pic',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 5
    },
  },
  {
    label: '护工ID',
    field: 'nursesId',
    component: 'Input',
  },
  {
    label: '订单ID',
    field: 'orderId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入订单ID!' },
      ];
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "valid_status"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入状态!' },
      ];
    },
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: { title: '服务人员姓名', order: 0, view: 'text', type: 'string', },
  createBy: { title: '创建人', order: 1, view: 'text', type: 'string', },
  createTime: { title: '创建时间', order: 2, view: 'datetime', type: 'string', },
  updateTime: { title: '更新时间', order: 3, view: 'datetime', type: 'string', },
  updateBy: { title: '更新人', order: 4, view: 'text', type: 'string', },
  avatar: { title: '头像', order: 5, view: 'image', type: 'string', },
  openid: { title: '微信openid', order: 6, view: 'text', type: 'string', },
  unionid: { title: '微信unionid', order: 7, view: 'text', type: 'string', },
  idcard: { title: '身份证号', order: 8, view: 'text', type: 'string', },
  phone: { title: '手机号码', order: 9, view: 'text', type: 'string', },
  status: { title: '是否有效', order: 10, view: 'radio', type: 'string', },
  sex: { title: '性别', order: 11, view: 'radio', type: 'string', },
  isShow: { title: '是否显示到微信', order: 12, view: 'radio', type: 'string', },
  isHealth: { title: '是否健康管家', order: 13, view: 'radio', type: 'string', },
  life: { title: '服务年限', order: 14, view: 'number', type: 'number', },
  server: { title: '服务人数', order: 15, view: 'number', type: 'number', },
  area: { title: '地区', order: 16, view: 'text', type: 'string', },
  areaName: { title: '地区名称', order: 17, view: 'text', type: 'string', },
  rate: { title: '评分', order: 18, view: 'number', type: 'number', },
  profile: { title: '简介', order: 19, view: 'textarea', type: 'string', },
  ratio: { title: '佣金比例', order: 20, view: 'number', type: 'number', },
  job: { title: '职业', order: 21, view: 'text', type: 'string', },
  validate: { title: '是否上架', order: 22, view: 'radio', type: 'string', },
};
